package controller;

import model.Player;

import java.io.BufferedWriter;
import java.io.IOException;
import java.util.HashMap;

public class MessageController {
    static HashMap<String, BufferedWriter> playerChannels = new HashMap<String,BufferedWriter>();//整张地图的频道

    public static void showToPlayer(Player player, String message) throws IOException {
        BufferedWriter bw= playerChannels.get(player.getId());
        bw.write(message);
        bw.newLine();
        bw.flush();
    }
    public static void addPlayerChannels(String playerId,BufferedWriter bw){
        playerChannels.put(playerId,bw);
    }
    public static void removePlayerChannels(String playerId){
        playerChannels.remove(playerId);
    }
}
